﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Login : System.Web.UI.Page
{
    //System.ComponentModel.Component
    protected string strNameErr = "hid";
    protected string strPwdErr = "hid";



    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack)
        {
            string strName = Request.Form["txtUName"];
            string strPwd = Request.Form["txtPwd"];

            MODEL.Students model = new BLL.Students().Login(strName, strPwd) ;
            if (model != null)
            {
                string isAlways = Request.Form["chkIsAlways"];
                if (isAlways != null && isAlways.Equals("1"))
                {
                    HttpCookie cook = new HttpCookie("uInfo", model.SID.ToString());
                    cook.Expires = DateTime.Now.AddDays(2);
                    Response.Cookies.Add(cook);

                }
                else
                {
                    Session["uInfo"] = model.SID.ToString();
                }
                Response.Redirect("Default.aspx");
            }

        }


    }
}